/*
 *
 *  Instantatiate a new terminal shell.
 *
 *  Author: 
 *
 *   WORK: fernando.ruiz@ctv.es 
 *   HOME: correo@fernando-ruiz.com
 *
 *   Thanks at:
 *    Chris John
 *
 *  $Id: shell.h,v 1.3 2001/08/09 22:08:46 joel Exp $
 */
#include<Windows.h>

#ifndef __SHELL_H__
#define __SHELL_H__

#ifdef __cplusplus
extern "C" {
#endif	

#include <stdio.h>	
#include <stdint.h>

typedef unsigned int rtems_name;

typedef int (*shell_command_t)(int argc,char * argv[]);

struct shell_cmd_tt ;
typedef struct shell_cmd_tt shell_cmd_t;

struct shell_cmd_tt {
 char * name;
 char * usage;
 char * topic;
 shell_command_t command;
 shell_cmd_t * alias;
 shell_cmd_t * next;
};

shell_cmd_t * shell_lookup_cmd(char * cmd);
shell_cmd_t * shell_add_cmd(char * cmd,
                            char * topic,
                            char * usage,
                            shell_command_t command);
shell_cmd_t * shell_alias_cmd(char * cmd, char * alias);

int shell_make_args(char * cmd,
                    int  * pargc,
                    char * argv[]);

typedef struct  {
  unsigned int magic; /* 'S','E','N','V': Shell Environment */	
  char * devname;
  char * taskname;
  //tcflag_t tcflag;
  /* user extensions */
  int  exit_shell; /* logout */
  int  forever   ; /* repeat login */
  int  errorlevel;
  int  mdump_adr;
} shell_env_t;

/*--------*/
/* cmds.c */ 
/*--------*/
uint64_t str2int(char * s);
void register_cmds(void);
void process_line(unsigned char* line); 

#ifdef __cplusplus
}
#endif	

#endif
